{% extends "base/base.html" %}

{% load dv_extend %}

{% block main %}
    <h2>Search (BETA!!!)</h2>

    <form method="get" action=".">
        <table>
            {{ form.as_table }}
            <tr>
                <td>&nbsp;</td>
                <td>
                    <input type="submit" value="Search">
                </td>
            </tr>
        </table>

        {% if query %}
            <h3>Results</h3>
            {% for result in page.object_list %}
                <p>
                    {{ result.render|safe }}
                </p>
            {% empty %}
                <p>No results found.</p>
            {% endfor %}
            {% if page %}
                Pages: 
               {% for i in page.paginator.page_range %}
               <a href="?q={{ query }}&amp;page={{ i }}">{{ i }}</a> 
               {% endfor %}
            {% endif %}
        {% else %}
            Do the search!
            {# Show some example queries to run, maybe query syntax, something else? #}
        {% endif %}
    </form>
{% endblock %}
